#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
long long arr[N];
int q[N];
bool st[N];
long long sum;
int n, k;
int count1;
int main()
{
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> q[i];
	}
	int ma = -11;
	sort(q, q + n);
	int hh = 0;
	int tt = n;
	while (hh <= tt) {
		int t = q[hh++];
		sum += t;
		if (sum > k) {
			ma = max(ma, count1);
		}
		count1++;
		t *= 2;
		q[++tt] = t;
		sort(q, q + tt - hh);
	}
	cout << ma << endl;
	return 0;
}